<?php
///////////////////////////////////////////
// bierdopje.com API wrapper for PHP v 1 //
// license: GNU GPL 3                    //
///////////////////////////////////////////
require_once("bierglas.class.php");

class Bierglas_fopen extends Bierglas {

	protected function fetch_data($command, $data, $as_xml = true){
		$url = $this->api_url.$this->api_key.'/'.$command.'/'.$data;
		$fh = fopen($url, "r");
		//Clear data
		$data ='';
		//Load data from the fopen call
		while(!feof($fh))
		{
			$data .= fgets($fh);
		}
		fclose($fh);
		//If there is a error return nothing
		if($data === false) {return;}
		if($as_xml){
			return $this->data_to_xml($data);
		} else {
			return $data;
		}
	}
}

?>